package com.g5.edu.controller;


import com.g5.edu.common.Result;
import com.g5.edu.dto.ForumInfoDTO;
import com.g5.edu.service.IDfForumInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 论坛话题信息 前端控制器
 * </p>
 *
 * @author admin
 * @since 2021-10-29
 */
@Slf4j
@RestController
@RequestMapping("/edu/dfForumInfo")
public class DfForumInfoController {

    @Autowired
    private IDfForumInfoService iDfForumInfoService;

    /**
     * 获取前6条话题
     * @param num
     * @return
     */
    @GetMapping("/topic_list/{num}")
    public Result getTopicList(@PathVariable Integer num){
        log.info("接收到的参数为num --:"+ num);
        List<ForumInfoDTO> list = iDfForumInfoService.getTopicList(num);
        log.info("返回给页面的数组是--： " + list.toString());
        return Result.ok(list);
    }



}
